//
//  QPlayBoxSubView.m
//  QoilPublic
//
//  Created by 杨凯 on 16/7/4.
//  Copyright © 2016年 杨凯. All rights reserved.
//

#import "QPlayBoxSubView.h"

@interface QPlayBoxSubView()

@property (weak, nonatomic) IBOutlet UIView *horizonLine;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *horConst;

@property (weak, nonatomic) IBOutlet UIView *verticallyLine;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *verConst;

@property (weak, nonatomic) IBOutlet UIButton *indexOneButton;

@property (weak, nonatomic) IBOutlet UIButton *indexTwoButton;

@end
@implementation QPlayBoxSubView

- (void)awakeFromNib{
    [super awakeFromNib];
    [self setupAttbuild];
    [_indexTwoButton blueStyle];
}

- (void)setupAttbuild{

    self.layer.cornerRadius = 4.0;
    self.backgroundColor = [UIColor whiteColor];
    
    self.horizonLine.backgroundColor = [QColorUtility defaultLineColor];
    self.horConst.constant = 0.5;
    self.verticallyLine.backgroundColor = [QColorUtility defaultLineColor];
    self.verConst.constant = 0.5;
}

- (void)setIconName:(NSString *)iconName{
    _iconName = iconName;
    self.iconImageView.image = [UIImage imageNamed:_iconName];
}

- (void)setTitleName:(NSString *)titleName{
    _titleName = titleName;
    self.titleLabel.text = self.titleName;
}

- (void)setSubTitleName:(NSString *)subTitleName{
    _subTitleName = subTitleName;
    self.subTitleLabel.text = self.subTitleName;
}

- (void)setSubStyle:(NSInteger)subStyle{
    _subStyle = subStyle;
    switch (_subStyle) {
        case 0://客服电话
        {
            [self.indexOneButton setTitle:@"取消" forState:UIControlStateNormal];
            [self.indexTwoButton setTitle:@"呼叫" forState:UIControlStateNormal];
        }
            break;
        case 1://成为会员
        {
            [self.indexOneButton setTitle:@"取消" forState:UIControlStateNormal];
            [self.indexTwoButton setTitle:@"立即登录" forState:UIControlStateNormal];
        }
            break;
        case 2://取消订单
        {
            [self.indexOneButton setTitle:@"我再想想" forState:UIControlStateNormal];
            [self.indexTwoButton setTitle:@"确定" forState:UIControlStateNormal];

        }
            break;
        case 3://版本更新
        {
            [self.indexOneButton setTitle:@"取消" forState:UIControlStateNormal];
            [self.indexTwoButton setTitle:@"更新" forState:UIControlStateNormal];
            
        }
            break;
        case 4://代付款
        {
            [self.indexOneButton setTitle:@"取消" forState:UIControlStateNormal];
            [self.indexTwoButton setTitle:@"呼叫" forState:UIControlStateNormal];
    
        }
            break;

            
        default:
            break;
    }
}

- (IBAction)cancelButtonAction:(id)sender {
    
    if (_cancelBlock) {
        _cancelBlock();
    }
}

- (IBAction)agreeButtonAction:(id)sender {
    
    if (_agreeBlock) {
        _agreeBlock();
    }
}

@end
